/*
 ***************************************************************************
 * MediaTeK Inc.
 * 4F, No. 2 Technology	5th	Rd.
 * Science-based Industrial	Park
 * Hsin-chu, Taiwan, R.O.C.
 *
 * (c) Copyright 2002-2012, MTK.
 *
 * All rights reserved.	MediaTeK's source	code is	an unpublished work	and	the
 * use of a	copyright notice does not imply	otherwise. This	source code
 * contains	confidential trade secret material of MediaTeK Tech. Any attemp
 * or participation	in deciphering,	decoding, reverse engineering or in	any
 * way altering	the	source code	is stricitly prohibited, unless	the	prior
 * written consent of MediaTeK, Inc. is obtained.
 ***************************************************************************

	Module Name:
	omci_external_msg.h

	Abstract:

	Revision History:
	Who			When			What
	--------	----------		----------------------------------------------
	Name		Date			Modification logs
	jq.zhu		2012/6/28	Create
*/

#ifndef _OMCI_EXTERNAL_MSG_H
#define _OMCI_EXTERNAL_MSG_H

#include <stdint.h>

/* OMCI message type define */
#define MT_OMCI_MSG_TYPE_CREAT                  4
#define MT_OMCI_MSG_TYPE_DELETE                 6
#define MT_OMCI_MSG_TYPE_SET                    8
#define MT_OMCI_MSG_TYPE_GET                    9
#define MT_OMCI_MSG_TYPE_GET_ALL_ALARMS         11
#define MT_OMCI_MSG_TYPE_GET_ALL_ALARMS_NEXT    12
#define MT_OMCI_MSG_TYPE_MIB_UPLOAD             13
#define MT_OMCI_MSG_TYPE_MIB_UPLOAD_NEXT        14
#define MT_OMCI_MSG_TYPE_MIB_RESET              15
#define MT_OMCI_MSG_TYPE_ALARM                  16
#define MT_OMCI_MSG_TYPE_AVC                    17
#define MT_OMCI_MSG_TYPE_TEST                   18
#define MT_OMCI_MSG_TYPE_START_SW_DOWNLOAD      19
#define MT_OMCI_MSG_TYPE_DOWNLOAD_SEC           20
#define MT_OMCI_MSG_TYPE_END_SW_DOWNLOAD        21
#define MT_OMCI_MSG_TYPE_ACTIVE_SW              22
#define MT_OMCI_MSG_TYPE_COMMIT_SW              23
#define MT_OMCI_MSG_TYPE_SYNC_TIME              24
#define MT_OMCI_MSG_TYPE_REBOOT                 25
#define MT_OMCI_MSG_TYPE_GET_NEXT               26
#define MT_OMCI_MSG_TYPE_TEST_RST               27
#define MT_OMCI_MSG_TYPE_GET_CURR_DATA          28
#define MT_OMCI_MSG_TYPE_SET_TABLE              29
#define MT_OMCI_MSG_TYPE_MAX                    30

#define MT_OMCI_MSG_TYPE_SW_TIMEOUT             255

/* OMCI IPC command Type */
#define OMCI_IPC_CMD_TYPE_ME_CMD            	1  	//internal use
#define OMCI_IPC_CMD_TYPE_DEBUG_LEVEL       	2 	//internal use
#define OMCI_IPC_CMD_TYPE_DUMP_ALL_ME       	3 	//internal use
#define OMCI_IPC_CMD_TYPE_DUMP_ME_INST_LIST     4  	//internal use
#define OMCI_IPC_CMD_TYPE_TERMINATE_APP     	5  	//internal use
#define OMCI_IPC_CMD_TYPE_MIB_RESET         	6  	//internal use
#define OMCI_IPC_CMD_TYPE_CLEAR_MIB_DATA_SYNC 	7  	//internal use
#define OMCI_IPC_CMD_TYPE_CHECK_MEMORY_LEAK 	8  	//internal use
#define OMCI_IPC_CMD_TYPE_DUMP_INSTANCE     	9  	//internal use
#define OMCI_IPC_CMD_TYPE_GET_OMCI_STATE    	10  //internal use
#define OMCI_IPC_CMD_TYPE_GET_UPGRADE_STATE   	11  //internal use
#define OMCI_IPC_CMD_TYPE_SAVE_OMCI_PKT_EN      12  //internal use
#define OMCI_IPC_CMD_TYPE_SAVE_OMCI_MODE        13  //internal use
#define OMCI_IPC_CMD_TYPE_SAVE_GET_OMCI_PKT_EN  14  //internal use
#define OMCI_IPC_CMD_TYPE_SAVE_GET_OMCI_MODE    15  //internal use
#define OMCI_IPC_CMD_TYPE_GET_OMCI_VERSION    	16  //internal use
#define OMCI_IPC_CMD_TYPE_GET_MIB_SYNC    	    17  //internal use
#define OMCI_IPC_CMD_TYPE_TEST_XGPON		    18  //internal use
#define OMCI_IPC_CMD_TYPE_CLEAR_ALARM_EN		19	//internal use






#define EXTEND_OMCI_VERSION         0xB0
#define BASELINE_OMCI_VERSION         0xA0


#ifndef GNU_PACKED
#define GNU_PACKED __attribute__ ((packed))
#endif//GNU_PACKED


#define OMCI_BASELINE_PKT_LEN  48
#define OMCI_BASELINE_CONT_LEN  32
#define OMCI_BASELINE_MSG  0x0A
#define OMCI_EXTENED_MSG  0x0B

#define OMCI_PROJID 9
#define OMCI_MQ_FLAG_PATH "/tmp/omci/omci_cmd_mq" 

//  GNU_PACKED omciBaselinePayload_s
typedef struct GNU_PACKED omciBaselinePayload_s{
	uint16_t tranCorrelatId;/* transaction correlation identifier */
	uint8_t msgType;/*message type*/
	uint8_t devId;/*device ID*/
	uint32_t meId;/*ME ID*/
	uint8_t msgContent[OMCI_BASELINE_CONT_LEN];/* pointer to message content 32 byte*/
	uint8_t trailer[8];//OMCI trailer
}omciBaselinePayload_t,*omciBaselinePayload_ptr;

#define OMCI_EXTENDED_MSG_LEN           1980
#define OMCI_EXTENDED_MSG_CONT_LEN      1966
#define OMCI_EXTENED_MSG_HEADER         14
#define OMCI_EXEENTED_SIZE_OF_MIC       4

typedef struct GNU_PACKED omciExtendedPayload_s{
	uint16_t tranCorrelatId;/* transaction correlation identifier */
	uint8_t msgType;/*message type*/
	uint8_t devId;/*device ID*/
	uint32_t meId   ;   /*HIGH 16 bit: ME ID; LOW 16 bit: Instance ID*/
	uint16_t msgContentLength;/*message content length*/
	uint8_t msgContent[OMCI_EXTENDED_MSG_CONT_LEN];/* pointer to message content*/
	uint8_t mic[4];//OMCI message integrity check
}omciExtendedPayload_t,*omciExtendedPayload_ptr;

typedef struct GNU_PACKED omciGenericPayload_s{
	uint16_t tranCorrelatId;/* transaction correlation identifier */
	uint8_t msgType;/*message type*/
	uint8_t devId;/*device ID*/
	uint32_t meId   ;   /*HIGH 16 bit: ME ID; LOW 16 bit: Instance ID*/
	uint8_t baseMsgContLenth[0]; // not  used, no occur memory
	uint16_t msgContentLength;
	uint8_t msgContent[OMCI_EXTENDED_MSG_CONT_LEN];/* pointer to message content*/
	uint8_t mic[4];//OMCI message integrity check
}omciGenericPayload_t,*omciGenericPayload_ptr;

#define omciPayload_t omciGenericPayload_t
#define omciPayload_ptr omciGenericPayload_ptr


typedef struct omci_cmd_msg_s{
	long cmdType;//  cmd; 
	omciBaselinePayload_t payload;
}omci_cmd_msg_t;

typedef struct omci_ipc_cmd_msg_s{
	long msgType;
	omci_cmd_msg_t msg;
}omci_ipc_cmd_msg_t;


typedef struct GNU_PACKED mibUpload_Extend_pkt_s{
	uint16_t msgLen;
	uint8_t msgContent_ptr;
}mibUpload_Extend_pkt_t,*mibUpload_Extend_pkt_ptr;

typedef struct GNU_PACKED mibUpload_Extend_Inst_s{
	uint16_t instContentLen;
	uint16_t calssId;
	uint16_t instiID;
	uint16_t attributeMask;
	uint8_t instContent_ptr;
}mibUpload_Extend_Inst_t,*mibUpload_Extend_Inst_ptr;

#define MIB_UPLOAD_EXTEND_INST_HEAD_LEN             8



/*****************IPC for notification******************/
#define OMCI_NOTIFY_Q_FLAG_PATH "/tmp/omci/omci_notify_mq"


#define OMCI_NOTIFY_TYPE_ALARM          1
#define OMCI_NOTIFY_TYPE_AVC            2
#define OMCI_NOTIFY_TYPE_TCA            3
#define OMCI_NOTIFY_TYPE_TEST_RST       4
#define OMCI_NOTIFY_TYPE_PERIOD_AVC     5

/* alarm ID */
/* alarm ID = CLASS ID<<16 | ALARM INDEX */
#define OMCI_ALARM_ID_EQUIP_ALARM               (0)
#define OMCI_ALARM_ID_POWER_ALARM               (1)
#define OMCI_ALARM_ID_BATTERY_MISS_ALARM        (2)
#define OMCI_ALARM_ID_EQUIPMENT                 (0)
#define OMCI_ALARM_ID_POWERING                  (1)
#define OMCI_ALARM_ID_BATTERY_MISS              (2)
#define OMCI_ALARM_ID_BATTERY_FAIL              (3)
#define OMCI_ALARM_ID_BATTERY_LOW               (4)
#define OMCI_ALARM_ID_PHYSICAL_INSTU            (5)
#define OMCI_ALARM_ID_ONU_SELFTEST_FAIL         (6)
#define OMCI_ALARM_ID_ONU_DYING_GASP            (7)
#define OMCI_ALARM_ID_ONU_TEMPER_YELLOW         (8)
#define OMCI_ALARM_ID_ONU_TEMPER_RED            (9)
#define OMCI_ALARM_ID_ONU_VOLTAGE_YELLOW        (10)
#define OMCI_ALARM_ID_ONU_VOLTAGE_RED           (11)
#define OMCI_ALARM_ID_ONU_ONU_MANANA_POWER_OFF  (12)
#define OMCI_ALARM_ID_ONU_INV_IMAGE             (13)
#define OMCI_ALARM_ID_ONU_PSE_OVERLOAD_YELLOW   (14)
#define OMCI_ALARM_ID_ONU_PSE_OVERLOAD_RED      (15)

#define OMCI_ALARM_ID_LOW_RX_OPTICAL            (0)
#define OMCI_ALARM_ID_HIGH_RX_OPTICAL           (1)
#define OMCI_ALARM_ID_SF                        (2)
#define OMCI_ALARM_ID_SD                        (3)
#define OMCI_ALARM_ID_LOW_TX_OPTICAL            (4)
#define OMCI_ALARM_ID_HIGH_TX_OPTICAL           (5)
#define OMCI_ALARM_ID_LASER_BIAS_CURRENT        (6)
#define OMCI_ALARM_ID_MAX_NUM			        (7)

#define OMCI_ALARM_ID_PPTPEthernetUNI_LAN_LOS_ALARM             (0x0)
#define OMCI_ALARM_ID_PPTPEthernetUNI_LAN_LOOPBACK_ALARM        (0x1)
#define OMCI_ALARM_ID_VEIP_CONNECTING_FUNCTION_FAIL             (0x0)

/*9.9.2 SIP user data*/
#define OMCI_ALARM_ID_SIP_USER_DATA_SIPUA_REG_AUTH              (0)
#define OMCI_ALARM_ID_SIP_USER_DATA_SIPUA_REG_TIMEOUT           (1)
#define OMCI_ALARM_ID_SIP_USER_DATA_SIPUA_REG_FAIL              (2)

/*9.9.3 SIP agent config data*/
#define OMCI_ALARM_ID_SIP_AGENT_CFG_DATA_SIPUA_REG_NAME         (0)
#define OMCI_ALARM_ID_SIP_AGENT_CFG_DATA_SIPUA_REG_REACH        (1)
#define OMCI_ALARM_ID_SIP_AGENT_CFG_DATA_SIPUA_REG_CONNECT      (2)
#define OMCI_ALARM_ID_SIP_AGENT_CFG_DATA_SIPUA_REG_VALID        (3)
                                                                          
/*9.9.16 MGC config data*/                                                
#define OMCI_ALARM_ID_MGC_CFG_DATA_TIMEOUT_ALARM                          (0)

/*9.9.18 VoIP config data*/
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SER_NAME                      (0)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SER_REACH                     (1)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SER_CONNECT                   (2)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SER_VALIDATE                  (3)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SER_AUTH                      (4)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SER_TIMEOUT                   (5)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SER_FAIL                      (6)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_FILE_ERROR                    (7)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SUBSCRIPTION_NAME             (8)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SUBSCRIPTION_REACH            (9)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SUBSCRIPTION_CONNECT          (10)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SUBSCRIPTION_VALIDATE         (11)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SUBSCRIPTION_AUTH             (12)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SUBSCRIPTION_TIMEOUT          (13)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_SUBSCRIPTION_FAIL             (14)
#define OMCI_ALARM_ID_VOIP_CFG_DATA_VCD_CFG_REBOOT_REQUEST                (15)

/* clock data set*/
#define OMCI_ALARM_ID_CLOCK_DATA_SET_OUN_LOST_ToD_SYNC_ALARM            (0)
#define OMCI_ALARM_ID_LoopDetection_LoopBack_EthPort1                (0)
#define OMCI_ALARM_ID_LoopDetection_LoopBack_EthPort2                (1)
#define OMCI_ALARM_ID_LoopDetection_LoopBack_EthPort3                (2)
#define OMCI_ALARM_ID_LoopDetection_LoopBack_EthPort4                (3)

/* AVC ID  = CLASS ID<<16 | ATTRI INDEX */
#define OMCI_AVC_ID_CURRENT_ADDR			(0x9)
#define OMCI_AVC_ID_CURRENT_MASK			(0xa)
#define OMCI_AVC_ID_CURRENT_GATEWAY			(0xb)
#define OMCI_AVC_ID_CURRENT_PRIM_DNS		(0xc)
#define OMCI_AVC_ID_CURRENT_SECOND_DNS		(0xd)
#define OMCI_AVC_ID_DOMAIN_NAME				(0xe)
#define OMCI_AVC_ID_HOST_NAME				(0xf)
#define OMCI_AVC_ID_ANI_G_ARC 							(8)
#define OMCI_AVC_ID_ONU2_G_OMCC_VERSION					(2)
#define OMCI_AVC_ID_ONU_G_OP_STATE 						(8)
#define OMCI_AVC_ID_ONU_G_LOID							(10)
#define OMCI_AVC_ID_ONU_G_LPW							(11)
#define OMCI_AVC_ID_BUFFER_TABLE	                    (0x2)
#define OMCI_AVC_ID_FILE_TRANSFER_STATUS 				(0x7)
#define OMCI_AVC_ID_STATUS_DOCUMENT 					(0x1)
#define OMCI_AVC_ID_CONFIGURATION_DOCUMENT 								(0x2)
#define OMCI_AVC_ID_ENHANCED_SECURITY_CTL_ONU_RANDOM_CHALLENGE_TB		(0x5)
#define OMCI_AVC_ID_ENHANCED_SECURITY_CTL_ONU_AUTHENTICATION_RESULT_TB	(0x6)
#define OMCI_AVC_ID_ENHANCED_SECURITY_CTL_ONU_AUTHENTICATION_STATUS		(0x9)
#define OMCI_AVC_ID_GEM_IWTP_OPERATIONAL_STATE				(0x6)
#define OMCI_AVC_ID_MULTICAST_GEM_IWTP_OPERATIONAL_STATE	(0x6)
#define OMCI_AVC_ID_PPTPEthernetUNI_SENSED_TYPE				(0x2)
#define OMCI_AVC_ID_PPTPEthernetUNI_OPERATIONAL_STATE		(0x6)
#define OMCI_AVC_ID_PPTPEthernetUNI_ARC						(0xB)
#define OMCI_AVC_ID_VEIP_OPERATIONAL_STATE					(0x2)
#define OMCI_AVC_ID_IP_HOST_CUR_ADDR						(0x9)
#define OMCI_AVC_ID_IP_HOST_CUR_MASK						(0xa)
#define OMCI_AVC_ID_IP_HOST_CUR_GATEWAY						(0xb)
#define OMCI_AVC_ID_IP_HOST_CUR_PRIMARY_DNS					(0xc)
#define OMCI_AVC_ID_IP_HOST_CUR_SECONDARY_DNS				(0xd)
#define OMCI_AVC_ID_IP_HOST_DOMAIN_NAME						(0xe)
#define OMCI_AVC_ID_IP_HOST_HOST_NAME						(0xf)
/*9.9.3 SIP agent config data*/
#define OMCI_AVC_ID_SIP_AGENT_CFG_DATA_SIP_STATUS           (0x09)
/*9.9.12: Call Ctrl PM history data*/
#define OMCI_TCA_ID_CALL_CTRL_SETUP_FAIL						    (0x1)
#define OMCI_TCA_ID_CALL_CTRL_SETUP_TIMER						    (0x2)
#define OMCI_TCA_ID_CALL_CTRL_TMINAT_FAIL						    (0x3)
#define OMCI_TCA_ID_CALL_CTRL_PORT_RELEASE						    (0x4)
#define OMCI_TCA_ID_CALL_CTRL_PORT_OH_TIMER						    (0x5)

/*9.9.13: RTP PM history data*/
#define OMCI_TCA_ID_RTP_RTP_ERROR						     	    (0x1)
#define OMCI_TCA_ID_RTP_PACKET_LOSS						     	    (0x2)
#define OMCI_TCA_ID_RTP_MAX_JITTER						     	    (0x3)
#define OMCI_TCA_ID_RTP_MAX_BET_RTCP						     	(0x4)
#define OMCI_TCA_ID_RTP_BUFFER_UNDERFLOWS			            	(0x6)
#define OMCI_TCA_ID_RTP_BUFFER_OVERFLOWS			             	(0x7)

/*9.9.14 SIP agent performance monitoring history data*/
#define OMCI_TCA_ID_SIPAMD_RX_INV_REQ                               (0x1)
#define OMCI_TCA_ID_SIPAMD_RX_INV_REQ_RETRAS			     	    (0x2)
#define OMCI_TCA_ID_SIPAMD_RX_NOINV_REQ					     	    (0x3)
#define OMCI_TCA_ID_SIPAMD_RX_NOINV_REQ_RETRAS				     	(0x4)
#define OMCI_TCA_ID_SIPAMD_RX_RESPONSE  			            	(0x5)
#define OMCI_TCA_ID_SIPAMD_RX_RESPONS_RETRANS		             	(0x6)

/*9.9.15 SIP call initiation performance monitoring history data*/
#define OMCI_TCA_ID_SIP_CALL_PM_FAIL_CONNECT                        (0x1)
#define OMCI_TCA_ID_SIP_CALL_PM_FAIL_VALIDATE   		     	    (0x2)
#define OMCI_TCA_ID_SIP_CALL_PM_TIMEOUT         		     	    (0x3)
#define OMCI_TCA_ID_SIP_CALL_PM_FAIL_ERROR_CODE_RECEIVED	     	(0x4)
#define OMCI_TCA_ID_SIP_CALL_PM_FAILED_AUTH     	            	(0x5)


/*9.9.18 VoIP config data*/
#define OMCI_AVC_ID_VOIP_CFG_PROFILE_VERSION				(0x8)
#define OMCI_AVC_ID_PPTPPotsUNI_ARC							(0x3)
#define OMCI_AVC_ID_PPTPPotsUNI_OPERATIONAL_STATE			(0x9)

/* TCA ID  = CLASS ID<<16 | TCA NUM */
#define NO_TCA		0
#define OMCI_TCA_ID_IP_HOST_PM_ICMP_ERR		(OMCI_CLASS_ID_IP_HOST_PM_HISTORY<<16|0x1)
#define OMCI_TCA_ID_FEC_PM_CORRECTEDBYTES                       (0x1)
#define OMCI_TCA_ID_FEC_PM_CORRECTEDODEWORDS   					(0x2)
#define OMCI_TCA_ID_FEC_PM_UNCORRECTABLECODEWORDS		  		(0x3)
#define OMCI_TCA_ID_FEC_PM_FECSECONDS					  		(0x4)

#define OMCI_TCA_ID_GEM_PORT_NETWORK_CTP_PM                     (0x1)

//9.2.6 GEM port performance monitoring PM
#define OMCI_TCA_ID_GEM_PORT_PM_LOST_PACKETS					(0x1)
#define OMCI_TCA_ID_GEM_PORT_PM_MISINSERTED_PACKETS				(0x2)
#define OMCI_TCA_ID_GEM_PORT_PM_IMPAIRED_PACKETS				(0x3)

//Alcatel ME:  GEM port performance monitoring PM
#define OMCI_TCA_ID_TOTAL_GEM_PORT_PM_LOST_COUNTER_DOWNSTREAM			(0x1)
#define OMCI_TCA_ID_TOTAL_GEM_PORT_PM_LOST_COUNTER_UPSTREAM				(0x2)
#define OMCI_TCA_ID_TOTAL_GEM_PORT_PM_IMPAIRED_BLOCKS					(0x3)
#define OMCI_TCA_ID_TOTAL_GEM_PORT_PM_BAD_RECEIVED_CONTERS				(0x4)

//Alcatel ME:  Ethernet Traffic PM
#define OMCI_TCA_ID_ETHERNET_TRAFFIC_PM_DROPPED_FRAMES_UPSTREAM_COUNTER 			(0x1)
#define OMCI_TCA_ID_ETHERNET_TRAFFIC_PM_DROPPED_BYTES_UPSTREAM_COUNTER				(0x2)
#define OMCI_TCA_ID_ETHERNET_TRAFFIC_PM_DROPPED_FRAMES_DOWNSTREAM_COUNTER			(0x3)

#define OMCI_TCA_ID_LOST_GEM_FRAGMENT_COUNTER							(0x1)

/*9.3.3 MAC bridge performance monitoring history data ME*/
#define OMCI_TCA_ID_MAC_BRIDGE_PM_LEARN_ENTRY_DISCARD_CNTS				(0x1)

/*9.3.9 mac bridge port performance monitoring history data ME*/
#define OMCI_TCA_ID_MAC_BRIDGE_PORT_PM_DELAY_EXCEED_DISCARD_CNTS		(0x1)
#define OMCI_TCA_ID_MAC_BRIDGE_PORT_PM_MTU_EXCEED_DISCARD_CNTS			(0x2)
#define OMCI_TCA_ID_MAC_BRIDGE_PORT_PM_RECEIVED_DISCARD_CNTS			(0x3)

/*9.3.30 ethernet frame performance monitoring history data upstream*/
#define OMCI_TCA_ID_MAC_BRIDGE_PORT_PM_UP_DELAY_EXCEED_DISCARD_CNTS		(0x1)
#define OMCI_TCA_ID_ETH_FRAME_PM_UP_CRC_ERRORS_PKTS						(0x2)
#define OMCI_TCA_ID_ETH_FRAME_PM_UP_UNDERSIZE_PKTS						(0x3)
#define OMCI_TCA_ID_ETH_FRAME_PM_UP_OVERSIZE_PKTS						(0x4)

/*9.3.31 ethernet frame performance monitoring history data downstream*/
#define OMCI_TCA_ID_MAC_BRIDGE_PORT_PM_DOWN_DELAY_EXCEED_DISCARD_CNTS	(0x1)
#define OMCI_TCA_ID_ETH_FRAME_PM_DOWN_CRC_ERRORS_PKTS					(0x2)
#define OMCI_TCA_ID_ETH_FRAME_PM_DOWN_UNDERSIZE_PKTS					(0x3)
#define OMCI_TCA_ID_ETH_FRAME_PM_DOWN_OVERSIZE_PKTS						(0x4)

/*9.2.8 GAL Ethernet performance monitoring history data*/
#define OMCI_TCA_ID_GAL_ETHERNET_PM_DISCARDED_FRAMES					(0x1)

/*9.5.2: Ethernet PM history data*/
#define OMCI_TCA_ID_ETHERNET_PM_2_FEC_ERRORS							(0x1)
#define OMCI_TCA_ID_ETHERNET_PM_2_EXCESSIVE_COLLISION_CNT				(0x2)
#define OMCI_TCA_ID_ETHERNET_PM_2_LATE_COLLISION_CNT					(0x3)
#define OMCI_TCA_ID_ETHERNET_PM_2_FRAMES_TOO_LONG						(0x4)
#define OMCI_TCA_ID_ETHERNET_PM_2_BUFFER_OVERFLOWS_ON_RECEIVE			(0x5)
#define OMCI_TCA_ID_ETHERNET_PM_2_BUFFER_OVERFLOWS_ON_TRANSMIT			(0x6)
#define OMCI_TCA_ID_ETHERNET_PM_2_SINGLE_COLLISION_FRAME_CNT			(0x7)
#define OMCI_TCA_ID_ETHERNET_PM_2_MULTI_COLLISION_FRAME_CNT				(0x8)
#define OMCI_TCA_ID_ETHERNET_PM_2_SQE_CNT								(0x9)
#define OMCI_TCA_ID_ETHERNET_PM_2_DEFERRED_TRANSMISSION_CNT				(0xa)
#define OMCI_TCA_ID_ETHERNET_PM_2_INTERNAL_MAC_TRANSMIT_ERROR_CNT		(0xb)
#define OMCI_TCA_ID_ETHERNET_PM_2_CARRIER_SENSE_ERROR_CNT				(0xc)
#define OMCI_TCA_ID_ETHERNET_PM_2_ALIGNMENT_ERROR_CNT					(0xd)
#define OMCI_TCA_ID_ETHERNET_PM_2_INTERNAL_MAC_RECEIVE_ERROR_CNT		(0xe)
/*9.5.3: Ethernet PM history data 2*/
#define OMCI_TCA_ID_ETHERNET_PM_3_PPPOE_FILTERED_FRAME_CNT				(0x1)
/*9.5.4: Ethernet PM history data 3*/
#define OMCI_TCA_ID_ETHERNET_PM_4_DROP_EVENTS							(0x1)
#define OMCI_TCA_ID_ETHERNET_PM_4_UNDERSIZE_PACKETS						(0x2)
#define OMCI_TCA_ID_ETHERNET_PM_4_FRAGMENTS								(0x3)
#define OMCI_TCA_ID_ETHERNET_PM_4_JABBERS								(0x4)
/*9.3.32 Ethernet frame extended PM*/
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_DROP_EVENTS				(0x1)
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_CRC_ERROR_FRAMES			(0x2)
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_UNDERSIZE_FRAMES			(0x3)
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_OVERSIZE_FRAMES			(0x4)
/*9.3.34 Ethernet frame extended PM64-bit*/
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_64BIT_DROP_EVENTS		(0x1)
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_64BIT_CRC_ERROR_FRAMES	(0x2)
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_64BIT_UNDERSIZE_FRAMES	(0x3)
#define OMCI_TCA_ID_ETHERNET_FRAME_EXTENDED_PM_64BIT_OVERSIZE_FRAMES	(0x4)


/*9.4.2 IP Host config data PM*/
#define OMCI_TCA_ID_IP_HOST_PM_ICMP_ERRORS								(0x1)
#define OMCI_TCA_ID_IP_HOST_PM_DNS_ERRORS								(0x2)
#define OMCI_TCA_ID_IP_HOST_PM_DHCP_TIMEOUT								(0x3)
#define OMCI_TCA_ID_IP_HOST_PM_IP_CONFLICT								(0x4)
#define OMCI_TCA_ID_IP_HOST_PM_OUT_OF_MEMORY							(0x5)
#define OMCI_TCA_ID_IP_HOST_PM_INTERNAL_ERROR							(0x6)
/*9.4.4 TCP/UDP config data PM*/
#define OMCI_TCA_ID_TCP_UDP_PM_SOCKET_FAILED							(0x1)
#define OMCI_TCA_ID_TCP_UDP_PM_LISTEN_FAILED							(0x2)
#define OMCI_TCA_ID_TCP_UDP_PM_BIND_FAILED								(0x3)
#define OMCI_TCA_ID_TCP_UDP_PM_ACCEPT_FAILED							(0x4)
#define OMCI_TCA_ID_TCP_UDP_PM_SELECT_FAILED							(0x5)


#define OMCI_CLASS_ID_ONU_DATA                                  2
#define OMCI_CLASS_ID_PON_IF_LINE_CARDHOLDER                    3
#define OMCI_CLASS_ID_CARDHOLDER                                5
#define OMCI_CLASS_ID_CIRCUIT_PACK                              6
#define OMCI_CLASS_ID_SOFTWARE_IMGAE                            7
#define OMCI_CLASS_ID_PPTP_ETHERNET_UNI                         11
#define OMCI_CLASS_ID_ETHERNET_PM_HISTORY_DATA                  24
/*9.3.1 mac bridge service profile*/
 #define OMCI_CLASS_ID_MAC_BRIDGE_SERVICE_PROFILE            45
/*9.3.2 mac bridge configuration data*/
#define OMCI_CLASS_ID_MAC_BRIDGE_CON_DATA                    46
/*9.3.4 mac bridge port configuration data*/
#define OMCI_CLASS_ID_MAC_BRIDGE_PORT_CON_DATA               47
/*9.3.5 mac bridge port designation data*/
#define OMCI_CLASS_ID_MAC_BRIDGE_PORT_DESIGNATION_DATA       48
/*9.3.6 mac bridge port filter table table*/
#define OMCI_CLASS_ID_MAC_BRIDGE_PORT_FILTER_TABLE_DATA      49
/*9.3.8 mac bridge port bridge table data*/
#define OMCI_CLASS_ID_MAC_BRIDGE_PORT_TABLE_DATA             50
/*9.3.3 mac bridge performance monitoring history data
   PMHD=performance monitoring history data*/
#define OMCI_CLASS_ID_MAC_BRIDGE_PMHD                        51
/*9.3.9 mac bridge port performance monitoring history data
   PMHD=performance monitoring history data*/
#define OMCI_CLASS_ID_MAC_BRIDGE_PORT_PMHD                   52
/*9.9.1 Physical path termination point POTS UNI*/
#define OMCI_CLASS_ID_PPTP_POTS_UNI                          53
/*9.9.6 Voice service profile*/
#define OMCI_CLASS_ID_VOICE_SERVICE_PROFILE                               58
/*9.3.12 vlan tagging operation configuration data*/
#define OMCI_CLASS_ID_VLAN_TAG_OPERATE                       78
/*9.3.7 mac bridge port filter preassign table*/
#define OMCI_CLASS_ID_MAC_BRIDGE_PORT_FILTER_PREASSIGN_DATA  79
/*9.13.1 Physical path termination point Video UNI*/
#define OMCI_CLASS_ID_PPTP_VIDEO_UNI                         82
/*9.13.2 Physical path termination point Video ANI*/
#define OMCI_CLASS_ID_PPTP_VIDEO_ANI                         90

/*9.3.11 vlan tagging filter data*/
#define OMCI_CLASS_ID_VLAN_TAG_FILTER_DATA                   84
#define OMCI_CLASS_ID_ETHERNET_PM_HISTORY_DATA_2                89
/*9.3.10 802.1p mapper service profile*/
#define OMCI_CLASS_ID_802_1P_MAPPER                            130

#define OMCI_CLASS_ID_OLT_G                                     131
#define OMCI_CLASS_ID_ONU_POWER_SHEDDING                        133
#define OMCI_CLASS_ID_IP_HOST_CONFIG_DATA                       134
#define OMCI_CLASS_ID_IP_HOST_PM                                135
#define OMCI_CLASS_ID_TCP_UDP_CFGDATA                           136
#define OMCI_CLASS_ID_NETWORK_ADDRESS                           137

/*9.9.18 VoIP config data*/
#define OMCI_CLASS_ID_VOIP_CFG_DATA                             138
#define OMCI_CLASS_ID_VOIP_VOICE_CTP                           139 		/* 9.9.4 */
#define OMCI_CLASS_ID_CALL_CTRL_PM_HISTORY                                140        /* 9.9.12 */
#define OMCI_CLASS_ID_VOIP_LINE_STATUS                          141
/*9.9.5 VoIP media profile*/
#define OMCI_CLASS_ID_VOIP_MEDIA_PROFILE                        142
/*9.9.7 	RTP profile data*/
#define OMCI_CLASS_ID_RTP_PROFILE_DATA                                    143
/*9.9.13 RTP PM*/
#define OMCI_CLASS_ID_RTP_PM_HISTORY_DATA                       144
/*9.9.10 Network dial plan table*/
#define OMCI_CLASS_ID_NETWORK_DIAL_PLAN_TBL                     145
/*9.9.8  VoIP application service profile*/
#define OMCI_CLASS_ID_VOIP_APP_SVC_PROFILE                      146


#define OMCI_CLASS_ID_AUTHENTICATION_METHOD                     148

/*9.9.3 SIP agent config data*/
#define OMCI_CLASS_ID_SIP_AGENT_CONFIG_DATA                     150
/*9.9.14 SIP agent performance monitoring history data*/
#define OMCI_CLASS_ID_SIP_AGENT_PM_HISTORY                         151
/*9.9.15 SIP call initiation performance monitoring history data*/
#define OMCI_CLASS_ID_SIP_CALL_INIT_PM_HISTORY                     152
/*9.9.2 SIP user data*/
#define OMCI_CLASS_ID_SIP_USER_DATA                             153
/*9.9.16 MGC config data*/
#define OMCI_CLASS_ID_MGC_CFG_DATA                              155

#define OMCI_CLASS_ID_LARGE_STRING                              157
#define OMCI_CLASS_ID_ONU_REMOTE_DEBUG                          158
#define OMCI_CLASS_ID_PROTECTION_PROFILE                        159
#define OMCI_CLASS_ID_EXTENSION_PACKAGE                         160
/*9.3.13 extended vlan tagging operation configuration data*/
#define OMCI_CLASS_ID_VLAN_TAG_EXTEND_OPERATE                171
        
#define OMCI_CLASS_ID_ETHERNET_PM_HISTORY_DATA_4                255       
#define OMCI_CLASS_ID_ONU_G                                     256
#define OMCI_CLASS_ID_ONU2_G                                    257
#define OMCI_CLASS_ID_T_CONT                                    262
#define OMCI_CLASS_ID_ANI_G                                     263
#define OMCI_CLASS_ID_UNI_G                                     264
/*9.2.4 GEM interworking termination point*/
#define OMCI_CLASS_ID_GEM_INTERWORK_TP                          266
/*9.2.6 GEM port performance monitoring history data*/      
#define OMCI_CLASS_ID_GEM_PORT_PM                               267
#define OMCI_CLASS_ID_GEM_PORT_CTP                              268
/*9.2.7 GAL Ethernet profile*/      
#define OMCI_CLASS_ID_GAL_ETHERNET_PROFILE                      272
#define OMCI_CLASS_ID_THRESHOLD_DATA1                           273
#define OMCI_CLASS_ID_THRESHOLD_DATA2                           274
/*9.2.8 GAL Ethernet performance monitoring history data*/
#define OMCI_CLASS_ID_GAL_ETHERNET_PM                           276
#define OMCI_CLASS_ID_PRIORITY_QUEUE                            277
#define OMCI_CLASS_ID_TRAFFIC_SCHEDULER                         278
#define OMCI_CLASS_ID_PROTECTION_DATA                           279
#define OMCI_CLASS_ID_TRAFFIC_DESCRIPTOR                        280
/*9.2.5 Multicast GEM interworking termination point*/      
#define OMCI_CLASS_ID_MULTICAST_GEM_INTERWORK_TP                281
#define OMCI_CLASS_ID_OMCI                                      287
#define OMCI_CLASS_ID_MANAGED_ENTITY                            288
#define OMCI_CLASS_ID_ATTRIBUTE                                 289
#define OMCI_CLASS_ID_ETHERNET_PM_HISTORY_DATA_3                296
#define OMCI_CLASS_ID_PORT_MAPPING                              297
/*9.3.18: Dot1 rate limiter*/       
#define OMCI_CLASS_ID_DOT1_RATE_LIMITER                         298
/*9.3.19 Dot1ag maintenance domain*/
#define OMCI_CLASS_ID_DOT1AG_MAINTENANCE_DOMAIN                 299
/*9.3.20 Dot1ag maintenance association*/       
#define OMCI_CLASS_ID_DOT1AG_MAINTENANCE_ASSOCIATION            300    
#define OMCI_CLASS_ID_OCTET_STRING                              307
#define OMCI_CLASS_ID_GENERAL_BUFFER                            308

/*9.3.27 multicast operations profile*/
#define OMCI_CLASS_ID_MULTICAST_OPERATE_PROFILE              309
/*9.3.28 multicast subscriber config info*/
#define OMCI_CLASS_ID_MULTICAST_SUBSCRIBER_CFG_INFO          310
/*9.3.29 multicast subscriber monitor*/
#define OMCI_CLASS_ID_MULTICAST_SUBSCRIBER_MONITOR           311

#define OMCI_CLASS_ID_FEC_PM_DATA                               312
#define OMCI_CLASS_ID_FILE_TRANSFER_CONTROLLER                  318
/*9.3.31 ethernet frame performance monitoring history data downstream
   PMHD=performance monitoring history data*/
#define OMCI_CLASS_ID_ETHERNET_FRAME_DOWN_PMHD               321
/*9.3.30 ethernet frame performance monitoring history data upstream
   PMHD=performance monitoring history data*/
#define OMCI_CLASS_ID_ETHERNET_FRAME_UP_PMHD                 322

#define OMCI_CLASS_ID_VIRTUAL_ETHERNET_INTERFACE_POINT          329
#define OMCI_CLASS_ID_GENERIC_STATUS                            330
#define OMCI_CLASS_ID_ONU_E                                     331
#define OMCI_CLASS_ID_ENHANCED_SECURITY_CONTROL                 332

#define OMCI_CLASS_ID_ETHERNET_FRAME_EXTENDED_PM                334

#define OMCI_CLASS_ID_SNMP_CONFIG_DATA                          335
#define OMCI_CLASS_ID_ONU_DYNAMIC_POWER                         336
#define OMCI_CLASS_ID_TR069_MANAGE_SERVER                       340
#define OMCI_CLASS_ID_GEM_PORT_NETWORK_CTP_PM                   341
#define OMCI_CLASS_ID_TCP_UDP_PM                                342
#define OMCI_CLASS_ID_ENERGY_CONSUMPTION_PM                     343
#define OMCI_CLASS_ID_XGPON_TC_PM                               344
#define OMCI_CLASS_ID_XGPON_DS_MGNT_PM                          345
#define OMCI_CLASS_ID_XGPON_US_MGNT_PM                          346
#define OMCI_CLASS_ID_MAC_BRIDGE_PORT_ICMPV6                    348

/*9.3.34 ethernet frame extended pm 64-bit*/
#define OMCI_CLASS_ID_ETHERNET_FRAME_EXTENDED_PM_64_BIT         425
/*9.2.22 Enhanced FEC performace monitoring history data*/
#define OMCI_CLASS_ID_ENHANCED_FEC_PM_DATA                      453
/*9.2.23  Enhanced TC performance monitoring history data*/
#define OMCI_CLASS_ID_ENHANCED_TC_PM                            454
/*9.12.17 threshold data 64 bit*/
#define OMCI_CLASS_ID_THRESHOLD_DATA_64_BIT						426
/*9.12.19 time status message*/
#define OMCI_CLASS_ID_TIME_STATUS_MESSAGE						440

/* CTC ME class ID */
#define OMCI_CLASS_ID_CTC_ONU_LOOP_DETECTION                    65528
#define OMCI_CLASS_ID_CTC_ONU_CAPABILITY                        65529
#define OMCI_CLASS_ID_CTC_LOID_AUTHEN                           65530
#define OMCI_CLASS_ID_CTC_EXTENDED_MUTICAST_PROFILE             65531

#define OMCI_CLASS_ID_VOIP_CALL_STATISTICS                      65284
#define OMCI_CLASS_ID_CLOCK_DATA_SET                            65314
#define OMCI_CLASS_ID_PTP_MASTER_CONFIG_DATA_PROFILE            65315
#define OMCI_CLASS_ID_PTP_Port                                  65316
#define OMCI_CLASS_ID_TOTAL_GEM_PORT_PM                         65281
#define OMCI_CLASS_ID_ETHERNET_TRAFFIC_PM                       65282
#define OMCI_CLASS_ID_VLAN_TAG_DOWNSTREAM_EGRESS_BEHAVIOR_SUPPLEMENTAL1         65305
#define OMCI_CLASS_ID_VLAN_TAG_UPSTREAM_POLICER                 65306
#define OMCI_CLASS_ID_ONT_OPTICAL_SUPERVISION_STATUS            65295
#define OMCI_CLASS_ID_UNI_SUPPLEMENTAL_1_V2                     65297
#define OMCI_CLASS_ID_ONT_GENERIC_V2                            65296
#define OMCI_CLASS_ID_GEMPORT_PROTOCOL_MONITORING_HISTORY_DATA_PART_2           65300

#define OMCI_CLASS_ID_CUC_ONU_CAPABILITY                            65457
#define OMCI_CLASS_ID_ONU_OPTICAL_TRANS_INFO                    65458



typedef struct notify_msg_s{
	uint8_t notifyType;// OMCI_NOTIFY_TYPE_ALARM;
	//alarm
	long alarmId;
	uint8_t alarmFlag;//OMCI_ALARM_ERR;OMCI_ALARM_RECOVERY
	//AVC
	long avcId;
	//TCA
	long tcaId;
	//test result
	long testRstId;//class ID | transId ;
	short deviceId;//mapping to instant ID
	uint8_t msgFormat;		//0x0A:baseline format   0X0B:extended format	
	uint8_t otherInfo[128];	
}notify_msg_t;



typedef struct omci_ipc_notify_msg_s{
	long msgType;// 
	notify_msg_t notifyMsg;
}omci_ipc_notify_msg_t;

#endif//_OMCI_EXTERNAL_MSG_H



